import { createApp } from 'vue'
import { createPinia } from 'pinia'

import App from './App.vue'
import router from './router'

// element-plus 的样式
import 'element-plus/theme-chalk/el-message.css'
import 'element-plus/theme-chalk/el-message-box.css'

// 引入 iconfont
import '@/styles/iconfont/iconfont.scss'

// 初始化 CSS 样式
import '@/styles/common.scss'

// pinia 持久化存储
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'

// 注册全局自定义指令
import {
  formatTimePlugin,
  formatPlyCountPlugin,
  formatMillisecPlugin,
  unixFormat,
  lazyImage
} from '@/utils/directives'

const app = createApp(App)
const pinia = createPinia()
pinia.use(piniaPluginPersistedstate)
app.use(formatTimePlugin)
app.use(formatPlyCountPlugin)
app.use(formatMillisecPlugin)
app.use(unixFormat)
app.use(lazyImage)
app.use(pinia)
app.use(router)

app.mount('#app')
